package com.yunduansing.core.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.yunduansing.core.dto.AccountDto;
import com.yunduansing.core.model.AccountModel;
import com.yunduansing.core.model.SysUser;

public interface AccountDao extends BaseDao<AccountModel> {
	//@Select("select id,account,'' password,status,name,nickname from sys_account where account=#{account} and password=#{password} and status=1")
	SysUser login(@Param(value = "account") String account);
	@Update("update sys_account set pwd=#{newPwd} where id=#{id}")
	boolean resetPassword(@Param(value = "newPwd") String newPwd,@Param(value = "id") int id);
	@Select("select count(id) from sys_account where id=#{id} and pwd=#{password}")
	int verifyByIdAndPwd(@Param(value="id") int id,@Param(value="password") String password);
	AccountDto getAccountWithGroupAndRole(int id);
	int deleteAccountGroup(int accountId);
	int saveAccountGroup(@Param(value="accountId") int accountId,@Param(value="list") List<Integer> list);
	int deleteAccountRole(int accountId);
	int saveAccountRole(@Param(value="accountId") int accountId,@Param(value="list") List<Integer> list);
	String getSalt(@Param(value="account") String account);
}
